package com.example.day02;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView mText1;
    private TextView mText2;
    private Button mButton;
    private TextView mTv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        mText2 = (TextView) findViewById(R.id.text2);


        mButton = (Button) findViewById(R.id.button);
        mButton.setOnClickListener(this);
        mTv = (TextView) findViewById(R.id.tv);
        Animation animation = AnimationUtils.loadAnimation(this, R.anim.dong);
        mTv.setAnimation(animation);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.button:
                Intent intent = new Intent(MainActivity.this, MainActivity2.class);
                startActivity(intent);
                break;
            default:
                break;
        }
    }
}
